{
  "properties" : { },
  "id" : "4dbee4642ab24d88995db92e5ee548fa",
  "script" : null,
  "groupId" : "43baf95fba7a40cebd8be100bec36201",
  "name" : "获取最后一个订单的信息",
  "createTime" : 1741019539170,
  "updateTime" : 1741367987274,
  "lock" : null,
  "createBy" : null,
  "updateBy" : null,
  "path" : "last_one",
  "method" : "GET",
  "parameters" : [ {
    "name" : "order_no",
    "value" : null,
    "description" : "订单编号",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : null,
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import log
import cn.dev33.satoken.stp.StpUtil
var userId = StpUtil.getLoginId()

//获取客户最后一个订单信息
 var order_bean = db.table("orders").where().eq("user_id",userId).orderByDesc("create_time").selectOne()
 if (order_bean!=null){
     return order_bean.result
 }else {
     exit 400, '订单不存在';
 }

 


